#!/bin/bash
# Copyright (c) 2020 rvvcim

logo="\n                     /\$\$         /\$\$    \n                    | \$\$        | \$\$    \n /\$\$\$\$\$\$\$\$  /\$\$\$\$\$\$\$| \$\$\$\$\$\$\$  /\$\$\$\$\$\$  \n|____ /\$\$/ /\$\$_____/| \$\$__  \$\$|_  \$\$_/  \n   /\$\$\$\$/ |  \$\$\$\$\$\$ | \$\$  \ \$\$  | \$\$    \n  /\$\$__/   \____  \$\$| \$\$  | \$\$  | \$\$ /\$\$\n /\$\$\$\$\$\$\$\$ /\$\$\$\$\$\$\$/| \$\$  | \$\$  |  \$\$\$\$/\n|________/|_______/ |__/  |__/   \___/  \n"

function main_menu (){
echo -e "${logo}"
echo -e " 1.修改字体"
sleep 0.015
echo -e " 2.修改配色"
sleep 0.015
echo -e " 0.退出工具"
sleep 0.015
echo -e ""
}
function main_in (){
cd ~
read -p "[ZRTool] ~> 请输入选项序号：" main_opt
case $main_opt in
1 )
	echo -e "\n\n"
	sleep 0.015
	font_menu ; font_in ;;
2 )
	echo -e "\n\n"
	sleep 0.015
	color_menu ; color_in ;;
0 )
	clear
	cat $PREFIX/etc/motd
	exit ;;
* )
	echo -e "[ZRTool] ~> 很抱歉，没有该选项~"
	sleep 1
	main_menu ; main_in ;;
esac
}
function font_menu (){
echo -e "${logo}"
sleep 0.015
echo -e " 1. Anonymous Powerline"
sleep 0.015
echo -e " 2. Droid Sans Mono for Powerline"
sleep 0.015
echo -e " 3. Inconsolata for Powerline"
sleep 0.015
echo -e " 4. Inconsolata-g for Powerline"
sleep 0.015
echo -e " 5. Iosevka-regular"
sleep 0.015
echo -e " 6. Monofur for Powerline"
sleep 0.015
echo -e " 7. Roboto Mono for Powerline"
sleep 0.015
echo -e " 8. Sauce Code Powerline Regular"
sleep 0.015
echo -e " 9. Ubuntu Mono derivative Powerline"
echo -e ""
echo -e " 0.返回上级菜单"
sleep 0.015
echo -e " 00.退出工具箱"
sleep 0.015
echo -e "---------------------------------------------"
sleep 0.015
echo -e ""
}
function font_in (){
cd ~
read -p "[ZRTool] ~> 请输入选项序号：" font_opt
case $font_opt in
1 )
	cp "$HOME/.termux/zshplugin/fonts/AnonymousPro/Anonymous Powerline.ttf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
2 )
	cp "$HOME/.termux/zshplugin/fonts/DroidSansMono/Droid Sans Mono for Powerline.otf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
3 )
	cp "$HOME/.termux/zshplugin/fonts/Inconsolata/Inconsolata for Powerline.otf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
4)
	cp "$HOME/.termux/zshplugin/fonts/Inconsolata-g/Inconsolata-g for Powerline.otf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
5 )
	cp "$HOME/.termux/zshplugin/fonts/Iosevka/Iosevka-regular.ttf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
6 )
	cp "$HOME/.termux/zshplugin/fonts/Monofur/Monofur for Powerline.ttf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
7 )
	cp "$HOME/.termux/zshplugin/fonts/RobotoMono/Roboto Mono for Powerline.ttf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
8 )
	cp "$HOME/.termux/zshplugin/fonts/SourceCodePro/Sauce Code Powerline Regular.otf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
9 )
	cp "$HOME/.termux/zshplugin/fonts/UbuntuMono/Ubuntu Mono derivative Powerline.ttf" "$HOME/.termux/font.ttf"
	termux-reload-settings
	font_menu ; font_in ;;
0 )
	echo -e "\n\n\n\n\n"
	sleep 0.015
	main_menu ; main_in ;;
00 )
	clear
	cat $PREFIX/etc/motd
	exit ;;
* )
	echo -e "[ZRTool] ~> 很抱歉，没有该选项~"
	sleep 1
	font_menu ; font_in ;;
esac
}
function color_menu (){
echo -e "${logo}"
sleep 0.015
echo -e " 1. aci.colors"
sleep 0.015
echo -e " 2. flat.colors"
sleep 0.015
echo -e " 3. pali.colors"
sleep 0.015
echo -e " 4. gruvbox.dark.colors"
sleep 0.015
echo -e " 5. material.colors"
sleep 0.015
echo -e " 6. solarized.light.colors"
sleep 0.015
echo -e " 7. tango.colors"
sleep 0.015
echo -e " 8. ura.colors"
sleep 0.015
echo -e " 9. vag.colors"
sleep 0.015
echo -e ""
echo -e " 0.返回上级菜单"
sleep 0.015
echo -e " 00.退出工具箱"
sleep 0.015
echo -e "---------------------------------------------"
sleep 0.015
echo -e ""
}
function color_in (){
cd ~
read -p "[ZRTool] ~> 请输入选项序号：" color_opt
case $color_opt in
1 )
	cp "$HOME/.termux/zshplugin/colors/aci.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
2 )
	cp "$HOME/.termux/zshplugin/colors/flat.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
3 )
	cp "$HOME/.termux/zshplugin/colors/pali.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
4 )
	cp "$HOME/.termux/zshplugin/colors/gruvbox.dark.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
5 )
	cp "$HOME/.termux/zshplugin/colors/material.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
6 )
	cp "$HOME/.termux/zshplugin/colors/solarized.light.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
7 )
	cp "$HOME/.termux/zshplugin/colors/tango.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
8 )
	cp "$HOME/.termux/zshplugin/colors/ura.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
9 )
	cp "$HOME/.termux/zshplugin/colors/vag.colors" "$HOME/.termux/colors.properties"
	termux-reload-settings
	color_menu ; color_in ;;
0 )
	echo -e "\n\n\n\n\n"
	sleep 0.015
	main_menu ; main_in ;;
00 )
	clear
	cat $PREFIX/etc/motd
	exit ;;
* )
	echo -e "[ZRTool] ~> 很抱歉，没有该选项~"
	sleep 1
	color_menu ; color_in ;;
esac
}

sleep 0.015
main_menu ; main_in
exit
